<?php /* Smarty version Smarty-3.1.14, created on 2017-08-21 15:29:49
         compiled from "E:\phpStudy\WWW\zyshop\admin\templates\goods_product.html" */ ?>
<?php /*%%SmartyHeaderCode:118055994ef636ba4d6-23362965%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'bc1b3a568468eb197ee6981d561eafecf9dadbb2' => 
    array (
      0 => 'E:\\phpStudy\\WWW\\zyshop\\admin\\templates\\goods_product.html',
      1 => 1503300570,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '118055994ef636ba4d6-23362965',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.14',
  'unifunc' => 'content_5994ef636e5ef9_10592483',
  'variables' => 
  array (
    'goods_products' => 0,
    'products' => 0,
    'goods_attr' => 0,
    'k' => 0,
    'goods' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5994ef636e5ef9_10592483')) {function content_5994ef636e5ef9_10592483($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<style>
td {  font-weight: bold;}
</style>
<body>
<div class="fixed-bar">
  <div class="item-title">
    <h3>设置商品库存</h3>
  </div>
</div>
<div class="fixed_bottom">
  <form method="post" action="nav_list.php" id="aspnetForm" name="form1" enctype="multipart/form-data">
    <div class="active_body" style="display:block;">
      <table style=" width:100%;" cellpadding="0" cellspacing="0" class="table tb-type2">
          <th>选择商品规格</th>
          <?php  $_smarty_tpl->tpl_vars['products'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['products']->_loop = false;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['goods_products']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['products']->key => $_smarty_tpl->tpl_vars['products']->value){
$_smarty_tpl->tpl_vars['products']->_loop = true;
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['products']->key;
?>
            <tr>
              <td class="firtd"><?php echo $_smarty_tpl->tpl_vars['products']->value['name'];?>
：</td>
              <td>  
                <?php  $_smarty_tpl->tpl_vars['goods_attr'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['goods_attr']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['products']->value['val']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['goods_attr']->key => $_smarty_tpl->tpl_vars['goods_attr']->value){
$_smarty_tpl->tpl_vars['goods_attr']->_loop = true;
?> 
                    <input class="gg<?php echo $_smarty_tpl->tpl_vars['goods_attr']->value['goods_attr_id'];?>
" type="checkbox" name="is_best<?php echo $_smarty_tpl->tpl_vars['goods_attr']->value['attr_id'];?>
" onClick="setattr(this,<?php echo $_smarty_tpl->tpl_vars['k']->value;?>
,'<?php echo $_smarty_tpl->tpl_vars['goods_attr']->value['attr_value'];?>
',<?php echo $_smarty_tpl->tpl_vars['goods_attr']->value['goods_attr_id'];?>
,<?php echo $_smarty_tpl->tpl_vars['goods']->value['goods_id'];?>
)" value="<?php echo $_smarty_tpl->tpl_vars['goods_attr']->value['goods_attr_id'];?>
"/>&nbsp;<?php echo $_smarty_tpl->tpl_vars['goods_attr']->value['attr_value'];?>
&nbsp;&nbsp;&nbsp;&nbsp;
                <?php } ?>
                <input type="hidden" class="attr_num<?php echo $_smarty_tpl->tpl_vars['k']->value;?>
" value="0" />
              </td>
            </tr>
          <?php } ?>
      </table>
      <table style=" width:100%;" cellpadding="0" cellspacing="0" border="1" class="table tb-type2">
      	<th colspan="20" align="center" style="background:#E5F6FE;"><span style="color:#000000;">商品名称：<?php echo $_smarty_tpl->tpl_vars['goods']->value['goods_name'];?>
&nbsp;&nbsp;&nbsp;&nbsp;货号：<?php echo $_smarty_tpl->tpl_vars['goods']->value['goods_sn'];?>
</span></th>
        <tr>
        	<?php  $_smarty_tpl->tpl_vars['products'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['products']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['goods_products']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['products']->key => $_smarty_tpl->tpl_vars['products']->value){
$_smarty_tpl->tpl_vars['products']->_loop = true;
?>
            <td><?php echo $_smarty_tpl->tpl_vars['products']->value['name'];?>
</td>
            <?php } ?>
        	<td width="200">货号</td>
            <td width="200">库存</td>
        </tr>
        <tr class="attr_consx"></tr>
        <!--<tr>
        	<?php  $_smarty_tpl->tpl_vars['products'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['products']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['goods_products']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['products']->key => $_smarty_tpl->tpl_vars['products']->value){
$_smarty_tpl->tpl_vars['products']->_loop = true;
?>
            <td>0</td>
            <?php } ?>
        	<td><input style="height:20px; width:150px;" type="text" name="product_sn[]" /></td>
            <td><input style="height:20px; width:150px;" class="goods_attrtext" type="text" name="product_number[]" /></td>
        </tr>-->
      </table>
      <!--将选中的属性保存-->
      <div class="attr_conc">
      	
      </div>
    </div>
    <div style="text-align:center">
      <div class="style1">&nbsp;</div>
      <div> <a href="JavaScript:void(0);" class="btn" onclick="reset()"><span>重置</span></a> <a href="JavaScript:void(0);" class="btn" onclick="$('#tj').click()"><span>确认提交</span></a> </div>
    </div>
    <input type="reset" id="cz" style="display: none;">
    <input type="submit" id="tj" style="display:none;">
  </form>
</div>

</body>
<script>
/*
 *商品不同属性对应库存配置
*/
function setattr(obj, key, attrval, attrid, goodsid){
	/*取得当前选中的属性*/
	var tt=$(obj).siblings("input[type=checkbox]").is(":checked");
	var num=0;
	if($(obj).is(":checked")){
		num++;
		var str ="<input alt='"+key+"' id='"+attrid+"' value='"+attrval+"' />";
		$(".attr_conc").html(str);
	}
	if(tt){num++;}
	$(obj).siblings("input[class^=attr_num]").val(num);
	var nn=$(obj).parents("tr").siblings().length;
	for(i=0;i<nn;i++){
		var tt=$(".attr_num"+i).val();
		//当有属性没有选中的时候
		if(tt<1){var ck=1;}
	}
	//将选中的属性存储
	
	
	//判断是否选中完整规格
	if(ck==1){
		var sms="<tr><td colspan='20'>请选择完整数据！</td></tr>";
		$(".attr_consx").html(sms);
	}else{
		
		$(".attr_consx").html("");
	}
}

</script>
</html><?php }} ?>